﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Apewer.Source
{

    /// <summary>用于执行 SQL 语句的参数。</summary>
    [Serializable]
    public class Parameter
    {

        /// <summary>名称，不可设置位为空。</summary>
        public string Name { get; set; }

        /// <summary>值。</summary>
        public object Value { get; set; }

        /// <summary>类型。</summary>
        public ColumnType Type { get; set; }

        /// <summary>类型为 VarChar 时，指定长度。</summary>
        public int Size { get; set; }

        /// <summary>创建用于执行 SQL 语句的参数，名称不可设置位为空。</summary>
        /// <exception cref="ArgumentException"></exception>
        /// <exception cref="ArgumentNullException"></exception>
        public Parameter(string name, object value, ColumnType type, int size = 0)
        {
            Name = name;
            Value = value;
            Type = type;
            Size = size;
        }

    }

}
